//these are action creator
let nextTodoId = 0

export const addTodo = (text) => {
  //返回的是action
  return {
	type: 'ADD', //type是必需的
    id: nextTodoId++,
    text
  }
}

export const deleteTodo = (id) => {
  //返回的是action
  return {
	type: 'DELETE', //type是必需的
    id: id
  }
}

export const toggleTodo = (id) => {
  return {
    type: 'TOGGLE',
    id
  }
}

export const editTodo = (id, text) => {
  return {
    type: 'EDIT',
    id,
	text
  }
}

export const setVisibilityFilter = (filter) => {
  return {
    type: 'SET_VISIBILITY_FILTER',
    filter
  }
}

